package com.code.wanmi.service.impl;

import com.code.wanmi.entity.wm_user.WmSysRole;
import com.code.wanmi.entity.wm_user.WmSysUser;
import com.code.wanmi.mapper.WmSysUserMapper;
import com.code.wanmi.service.IWmSysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author 谢晓峰
 * @since 2019-12-05
 */
@Service
public class WmSysUserServiceImpl extends ServiceImpl<WmSysUserMapper, WmSysUser> implements IWmSysUserService {

    @Autowired
    private WmSysUserMapper wmSysUserMapper;


    @Override
    public List<WmSysUser> selectlist() {
        return wmSysUserMapper.selectUsers();
    }
    /**删除某个用户
     * **/
    @Override
    public boolean remove(Long userId) {
        if(wmSysUserMapper.updateuser(userId)>0){
            return true;
        }
        return false;
    }


    @Override
    public Integer insertUser(WmSysUser user) {
        return wmSysUserMapper.insertUser(user) ;
    }

    @Override
    public WmSysUser selectUser(WmSysUser user) {
        return wmSysUserMapper.selectUser(user);
    }

    @Override
    public WmSysUser selectUserByUsernameAndPassword(WmSysUser user) {
        return wmSysUserMapper.selectUserByUsernameAndPassword(user);
    }

    @Override
    public Integer updateLoginIP(WmSysUser user) {
        return wmSysUserMapper.updateLoginIP(user);
    }

    /**
     * 修改用户信息
     * @param wmSysUser
     * @return
     */
    @Override
    public Integer updateUser(WmSysUser wmSysUser) {
        return wmSysUserMapper.updateUser(wmSysUser);
    }

    /**
     * 根据用户ID&登录名获取用户信息
     * @param wmSysUser
     * @return
     */
    @Override
    public WmSysUser selectUserByIdAndLoginName(WmSysUser wmSysUser) {
        return wmSysUserMapper.selectUserByIdAndLoginName(wmSysUser);
    }

}
